package common.view
{
	import flash.events.Event;
	
	import robotlegs.bender.bundles.mvcs.Mediator;
	
	public class FGUIMediator extends Mediator
	{
		public var data:*;
		
		private var nextFrameCallBacks:Vector.<Function>=new Vector.<Function>();
		
		public function FGUIMediator(){
			super();
		}
		
		protected function CallNextFrame(callback:Function):void{
			var index:int=nextFrameCallBacks.indexOf(callback);
			if(index<0){
				this.nextFrameCallBacks.push(callback);
			}
		}
		
		/**
		 * 心跳
		 */
		protected function Tick(e:Event=null):void{
			if(this.nextFrameCallBacks.length>0){
				var callBack:Function;
				for (var i:int = 0; i < nextFrameCallBacks.length; i++) 
				{
					callBack=nextFrameCallBacks[i];
					callBack();
				}
				this.nextFrameCallBacks.length=0;
			}
		}
	}
}